<template>
  <div class="app-container">
    <ht-search-form
      v-show="showSearch"
      :dictMap="dictMap"
      :queryParams="queryParams"
      :outputQueryParams="queryParams"
      :formOptions="formOptions"
      :advOptions="[]"
      defaultEventKey="entryTable"
    ></ht-search-form>
    <ht-table
      ref="dataTable"
      :showSerialNumber="false"
      :multi-select="false"
      :dictMap="dictMap"
      :reqConfig="reqConfig"
      :queryParams="queryParams"
      :tableBindColumns="tableBindColumns"
      defaultEventKey="entryTable"
    >
      <template v-slot:operate>
        <el-table-column label="操作" align="center" width="200" fixed="right" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '明细',
                  // permission: 'user:xxx:xxx',
                  doFunc: () => {
                    handleAction('approve', scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>
    <edit-info-dialog
      ref="editInfoDialog"
      :dictMap="dictMap"
      :form="form"
      @editComplete="editComplete"
    ></edit-info-dialog>
  </div>
</template>
<script>
import { apiUrlConfig, detail } from "@/api/cnaps/tips/FeeItemManage/FeeManageApprove.js";
import { listPageMixin } from "@/libs/listPageMixin";
import EditInfoDialog from "./components/FeeManageApproveDialog";
export default {
  name: "FeeManageApprove",
  mixins: [listPageMixin],
  components: { EditInfoDialog },
  data() {
    return {
      reqConfig: apiUrlConfig,
      //数据字典
      searchFormDictList: [
        "FEE_MANAGE_TYPE",
        "FEE_OPTTYPE",
        "FEE_STATUS",
        "FEE_SEGMT_FLG",
        "FEE_TYPE",
        "FEE_DISCOUNT_TYPE",
        "FEE_CHANNEL_TYPE",
        "FEE_CUST_LEVEL",
        "FEE_CHARGE_AUTOFLG",
        "FEE_CHARGE_AUTOTYPE",
        "FEE_DISCOUNT_STATUS",
        "FEE_CHARGE_STATUS",
        "TXN_SOURCE",
        "FEE_DISCOUNT_METHOD"
      ],
      showSearch: true,
      // 查询参数
      queryParams: {
        manageType: "",
        opttype: "",
      },
      form: {},
      formOptions: [],
      tableBindColumns: [
        {
          label: `管理类型`,
          prop: "manageType",
          align: "center",
          dictCode: "FEE_MANAGE_TYPE",
        },
        {
          label: `操作类型`,
          prop: "opttype",
          align: "center",
          dictCode: "FEE_OPTTYPE",
        },

        {
          label: `创建者`,
          prop: "mdTlrno",
          align: "center",
        },
        {
          label: `创建时间`,
          prop: "mdTime",
          align: "center",
          type: "date",
        },
        {
          label: `状态`,
          prop: "status",
          align: "center",
          dictCode: "FEE_STATUS",
        },
      ],
    };
  },
  mounted() {
    this.formOptions = [
      {
        type: "dict",
        dict: "FEE_MANAGE_TYPE",
        prop: "manageType",
        defaultAttr: {
          size: "small",
          label: "管理类型",
          placeholder: "请选择管理类型",
        },
      },

      {
        type: "dict",
        dict: "FEE_OPTTYPE",
        prop: "opttype",
        defaultAttr: {
          size: "small",
          label: "操作类型",
          placeholder: "请选择操作类型",
        },
      },
    ];
  },
  methods: {
    editComplete(state) {
      if (state == true) {
        this.$refs.dataTable.doQuery();
      }
    },
    handleAction(type, row) {
      switch (type) {
        case "approve":
          detail({ id: row.id, manageType: row.manageType }).then((res) => {
            this.form = res.result.data;
            this.form.manageType = res.result.manageType;
            this.form.isQuery = false;
            this.form.title = "手续费管理审核明细";
            this.$refs.editInfoDialog.show();
          });
          break;
      }
    },
  },
};
</script>
